#include <stack>

using namespace std;

class MyQueue {
private:
    stack<int> data;
public:
    /** Initialize your data structure here. */
    MyQueue() {}

    /** Push element x to the back of queue. */
    void push(int x) {
        stack<int> aux;
        while (data.size() > 0) {
            int val = data.top();
            aux.push(val);
            data.pop();
        }
        data.push(x);
        while (aux.size() > 0) {
            int val = aux.top();
            data.push(val);
            aux.pop();
        }
    }

    /** Removes the element from in front of queue and returns that element. */
    int pop() {
        int val = data.top();
        data.pop();
        return val;
    }

    /** Get the front element. */
    int peek() {
        return data.top();
    }

    /** Returns whether the queue is empty. */
    bool empty() {
        return data.size() == 0;
    }
};
